<template>
  <div class="hello">
    <input type="button" value="发送post请求" @click="handleSend">
    <input type="button" value="发送get请求" @click="handleSendGet">
  </div>
</template>

<script>

import axios from 'axios';

export default {
  name: 'HelloWorld',
  props: {
    msg: String
  },
  data() {

  },
  methods: {
    handleSend() {
      var url = '/api/admin/employee/login';
      var data = {
        username: 'admin',
        password: '123456'
      }
      axios.post(url, data).then(res => {
        console.log(res.data);
      }).catch(error => {
        console.log(error.response);
      })
    },

    handleSendGet() {
      var url = '/api/admin/employee/status';
      var data = {
        headers:{
          token:'eyJhbGciOiJIUzI1NiJ9.eyJlbXBJZCI6MSwiZXhwIjoxNzMzMzAwOTIyfQ.AP7l28tQSkElZZnmSrW3YfDjvlhkvi2cON11BdVZClA',
        }
      }
      axios.get(url, data).then(res => {
        console.log(res.data);
      }).catch(error => {
        console.log(error.response);
      })
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
  margin: 40px 0 0;
}

ul {
  list-style-type: none;
  padding: 0;
}

li {
  display: inline-block;
  margin: 0 10px;
}

a {
  color: #42b983;
}
</style>
